package com.adroiti.texasholdem.engine;


import com.adroiti.texasholdem.Card;
import com.adroiti.texasholdem.Hand;
import com.adroiti.texasholdem.Player;

public class PokerPlayer implements Player, Comparable<Player> {

	private Hand hand;
	private static int number = 0;
	private int playerNumber;
	private int place;
	
	public PokerPlayer(Hand hand){
		this.hand = hand;
		playerNumber = number;
		incNumber();
	}
	
	private static synchronized void incNumber(){
		number++;
	}

	@Override
	public void addCard(Card card) {
		hand.addCard(card);
	}


	@Override
	public Hand getHand() {
		return hand;
	}

	@Override
	public int compareTo(Player o) {
		return getHand().compareTo(o.getHand());
	}

	@Override
	public int getNumber() {
		return playerNumber;
	}

	@Override
	public int getPlace() {
		return place;
	}

	@Override
	public void setPlace(int place) {
		this.place = place;
	}
	
	@Override
	public String toString(){
		return "[" + getHand().toString() +"]";
	}

}
